// Copyright 2008 and onwards Matt Burkhart, Mike Chan.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.

#ifndef LOGGER_H__
#define LOGGER_H__

#include <pthread.h>
#include <stdio.h>

class Logger {
public:
  virtual ~Logger() {}

  // Loggers need only implement the Log method, but they must ensure that the
  // implementation is thread-safe.
  virtual void Log(const char message[], ...) = 0;
};

class DiskLogger : public Logger {
public:
  explicit DiskLogger(const char log_file_path[]);
  virtual ~DiskLogger();

  virtual void Log(const char message[], ...);

private:
  FILE* disk_log_;
  pthread_mutex_t disk_log_lock_;
};

#endif  // LOGGER_H__
